﻿using AppFramework.DinosaursParkMes.CodingRuleModel;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace AppFramework.DinosaursParkMes.ProductionPlanning
{
    public class ProductionPlanningMap : IEntityTypeConfiguration<AppFramework.DinosaursParkMes.ProductionPlanningModel.ProductionPlanning>
    {
        public void Configure(EntityTypeBuilder<AppFramework.DinosaursParkMes.ProductionPlanningModel.ProductionPlanning> builder)
        {
            builder.ToTable("tb_ProductionPlanning");
            builder.HasKey(x => x.Id);
            builder.Property(x => x.Planningnumber).HasComment("计划编号").HasColumnType("varchar(40)").IsRequired();
            builder.Property(x => x.Planningname).HasComment("计划名称").HasColumnType("varchar(20)").IsRequired();
            builder.Property(x => x.Sourcetype).HasComment("来源类型").HasColumnType("varchar(20)");
            builder.Property(x => x.Ordernumber).HasComment("订单编号").HasColumnType("varchar(40)").IsRequired();
            builder.Property(x => x.Finishedname).HasComment("成品名称").HasColumnType("varchar(20)").IsRequired();
            builder.Property(x => x.Finishednumber).HasComment("成品编号").HasColumnType("varchar(40)").IsRequired();
            builder.Property(x => x.Specificationversion).HasComment("规格型号").HasColumnType("varchar(20)");
            builder.Property(x => x.Finishedtype).HasComment("成品l类型").HasColumnType("varchar(20)");
            builder.Property(x => x.Unit).HasComment("单位").HasColumnType("varchar(20)");
            builder.Property(x => x.Planningcount).HasComment("计划数量");
            builder.Property(x => x.Remark).HasComment("备注").HasColumnType("varchar(200)");
            builder.Property(x => x.BOMNumber).HasComment("BOMb编号").HasColumnType("varchar(40)").IsRequired();
            builder.Property(x => x.State).HasComment("状态").IsRequired();
            //builder.HasIndex(x => new { x.Id, x.TargetForm, x.CodingName });
        }
    }
}
